package com.bkgy.controller.tcmEnSpeedRules.controller;

import com.bkgy.controller.tcmEnSpeedRules.entity.TcmEnSpeedRules;
import com.bkgy.controller.tcmEnSpeedRules.entity.pdo.TcmEnSpeedRulesQueryReq;
import com.bkgy.controller.tcmEnSpeedRules.entity.pdo.TcmEnSpeedRulesReq;
import com.bkgy.controller.tcmEnSpeedRules.service.ITcmEnSpeedRulesService;
import com.bkgy.sys.common.entity.ResultData;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Tag(name = "速度规则")
@Controller
@RequestMapping("/tcmEnSpeedRules")
public class TcmEnSpeedRulesController {

	@Autowired
	private ITcmEnSpeedRulesService service;

	@ResponseBody
	@Operation(summary = "新增")
	@PostMapping("/tcmEnSpeedRulesadd")
	public ResultData<String> savetcmEnSpeedRules (@RequestBody TcmEnSpeedRulesReq req){
		TcmEnSpeedRules obj = new TcmEnSpeedRules();
		BeanUtils.copyProperties(req,obj);
		return service.saveTcmEnSpeedRules(obj);
	}
	@ResponseBody
	@Operation(summary = "修改")
	@PostMapping("/tcmEnSpeedRulesupdate")
	public ResultData<String> updatetcmEnSpeedRules (@RequestBody TcmEnSpeedRules obj){
		obj.setUpdateTime(null);
		return service.updateTcmEnSpeedRules(obj);
	}
	@ResponseBody
	@Operation(summary = "删除")
	@PostMapping("/tcmEnSpeedRulesdelete")
	public ResultData<String> deletetcmEnSpeedRules (@RequestBody TcmEnSpeedRules obj){
		return service.deleteTcmEnSpeedRules(obj);
	}
	@ResponseBody
	@Operation(summary = "分页查询")
	@PostMapping("/tcmEnSpeedRulesPage")
	public ResultData<String> selectPage (@RequestBody TcmEnSpeedRulesQueryReq obj){
		return service.selectPage(obj);
	}
}
